<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
	<script type="text/javascript">
	    var _speedMark = new Date();
	</script>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"  />
    <title>商品详情页</title>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
	<meta http-equiv="x-dns-prefetch-control" content="on" />
	<link rel="dns-prefetch" href="http://static.paipaiimg.com" />
    <link combofile="detail/detail.shtml" rel="stylesheet" href="{$Think.config.RESOURCEURL}wx_assets/css/gb_v2.min.css?t=2014111801" />
    <link combofile="detail/detail.shtml" rel="stylesheet" href="{$Think.config.RESOURCEURL}wx_assets/css/detail.min.css?t=13883941581111527" />
	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/alertMsg.js"></script>
</head>
<body>
	<input type="hidden" id="referrerTxt" value="" /> 
    <div class="WX_bar">
        <div class="WX_bar_back">
            <a id="backUrl" href="javascript:history.go(-1);"></a>
        </div> 
        <div class="nav" id="topMenu">
            <a href="#detail" class="meunItem" for="detailDiv">商品详情</a>
           <!-- 
            <a href="#score" class="meunItem" for="scoreDiv">用户评价</a>
            -->
        </div>
    </div> 
    <div class="WX_con WX_detail" id="mainDiv">
    	<div class="d_sec" id="lowDiv" style="display:none"></div>
    	<div class="wg_container" id="scrollDiv"> 
            <div class="d_sec" id="detailView" style="z-index:0; -webkit-overflow-scrolling:touch;">
            	<div id="descDiv">
    	            <div class="d_sec_item goods">
    	                <div class="gallery">
    	                    <div class="gallery_list_wrap">
    	                        <ul class="gallery_list" id="cmdtyImgList">
    	                        	<li class="flex_box">
    	                        	<img id="bigImg" src="{$picUrl}" style="width: 160px;height:160px;"/>
    	                        	</li>
    	                        	 <notempty name="picUrl2">
			                            <li class="flex_box">
	    	                        	<img id="bigImg" src="{$picUrl2}" style="width: 160px;height:160px;"/>
	    	                        	</li>
                    				</notempty>
    	                        </ul>
    	                    </div>
    	                </div>
    	                <div class="goods_main">
    	                    <h1 class="goods_name">{$name}</h1>
    	                    <div class="goods_price"> 
    	                     	<notempty name="fixedPrice">
				                    <notempty name="discountedPrice">
				                     <span class="goods_price_wx">
				    	                            <span class="goods_price_tit">折扣价</span>
				    	                            <span class="goods_price_val">
				    	                                <span id="propPrice">
				    	                               	 &yen;{$discountedPrice}
				    	                                </span>
				    	                            </span>
				    	                        </span>
				    	                        <del class="goods_price_market">原价<span id="normalPrice">&yen;{$fixedPrice}</span></del>
				                    </notempty>
				                    
				                    <empty name="discountedPrice">
				                    	<span class="goods_price_wx">
				                            <span class="goods_price_tit">价格</span>
				                            <span class="goods_price_val">
				                                <span id="propPrice">
				                               	 &yen;{$fixedPrice}
				                                </span>
				                            </span>
				   	                 	</span>
				                    </empty>
				                </notempty>
				                
				               <notempty name="points">
				               	<if condition="$pointsType eq 'interact'">
				               		<span class="goods_price_wx">
				                           <span class="goods_price_tit">互动积分：</span>
				                           <span class="goods_price_val">
				                               <span id="propPrice">
				                              	 {$points}
				                               </span>
				                           </span>
				                           	积分
				  	                 	</span>
				               	<elseif condition="$pointsType eq 'consume'"/>
				               		<span class="goods_price_wx">
				                           <span class="goods_price_tit">消费积分：</span>
				                           <span class="goods_price_val">
				                               <span id="propPrice">
				                              	 {$points}
				                               </span>
				                           </span>
				                           	积分
				  	                 	</span>
				               	</if>
				               </notempty>
    	                     </div>
    	                     
    	                    <div class="goods_sku">
    	    					<div class="goods_sku_row" id="propertyDiv" style="z-index:9999;">
    	                        </div>                    
    	                    </div>
    	                    <if condition = "($showBtn eq 1)" >
    	                    <notempty name = "fixedPrice">
		      	 	  			<a class="btn_buy"  onclick="buy(this)" id="buyBtn">立即购买</a>
			               	</notempty>
			               	<notempty name = "points">
			               		<a class="btn_buy" onclick="buy(this)" id="buyBtn">立即兑换</a>
			               	</notempty>
    	                    </if>
    	                </div>
    	            </div>
    	            <!-- 
    	            <div class="d_sec_item" id="cmdtyParams">
    	                <h2 class="d_sec_item_tit">参数</h2>
    	                <div class="param">
    	                    <div class="param_item">
    	                        <table class="param_table">
    	                            <thead>
    	                                <tr>
    	                                    <th colspan="2" class="param_tit">基本参数</th>
    	                                </tr>
    	                            </thead>
    	                            <tbody>
    	                                	<td>品牌</td><td>Septwolves/七匹狼</td>
    	                                </tr>
    	                                	<td>货号</td><td>111320402031</td>
    	                                </tr>
    	                        </table>
    	                    </div>
    	                </div>
    	            </div>
    	             -->
    	            <div class="d_sec_item">
    	                <h2 class="d_sec_item_tit">商品详情<span style="font-size:10px;margin-left:10px;display:none;" id="descTips">(显示电脑端商品详细内容，会消耗您较多流量)</span></h2>
    	                <!-- 注：下为现网详情结构-->
    	                <div class="info mod_detail_info" id="detailInfo">
    	                    {$webPageContent}
    	                </div>
    	                <!-- 
    	                <div class="comment_loading" id="descLoadMsg"></div> 
    	                 -->
    	            </div>
                </div>
<!-- 
                <div class="d_sec_item">
                    <h2 class="d_sec_item_tit">用户评价</h2>
                    <div class="comment" id="scoreDiv"> 
                        <div class="comment_top"> 
                            <span class="comment_total" id="commentTotalTxt"></span>
                        </div>
                        <div class="comment_list" id="scoreList">
                        </div> 
                    </div>
                </div>
 -->
            </div> 
            <div id="scoreView" class="d_sec" style="position:absolute;left:100%;-webkit-overflow-scrolling:touch;"></div>
        </div>
    </div>
    	<div class="qb_quick_tip qb_none" id="bubble"></div>
<script type="text/javascript">
var inventory = {$inventory};
var totalInventoryCount = {$inventoryCount};
if (inventory == 1 && totalInventoryCount <= 0) {
	$("#buyBtn").addClass("btn_dis");
}
 var sku = new Array();
 var size = {$size};
 if (size != null) {
 	var sizeUnit = "{$sizeUnit}";
 	sku.push({"list": size, "pName":sizeUnit});
 }
 var color = {$color};
 if (color != null) {
 	var colorUnit = "{$colorUnit}";
 	sku.push({"list": color, "pName":colorUnit});
 }	
var availSku = {$availSku};
var orderType = '{$fixedPrice}' === '' ? 'point' : 'buy';
var PAGEMESS = {
	skuList: sku,
	stockAttrMap: availSku,
	inventory:inventory,
	orderType:orderType
	
	/*skuList: [{pName:"颜色",list:["白色","土黄色","101藏青色"]},{pName:"尺码",list:["29","30","31","32","33","34","35","36","37","38"]}],
      stockAttrMap: {"颜色:白色|尺码:29":{"activityPrice":23900,"activityType":43,"beginTime":0,"colorPrice":[],"createTime":1395303228000,"endTime":0,"index":0,"lastModifyTime":1395303228000,"sellerUin":855007014,"shopVipPrice":[23422,23183,22944,22705],"soldCount":0,"stockAttr":"颜色:白色|尺码:29","stockCount":0,"stockDesc":"","stockId":"158466873","stockLocalCode":"501129630","stockPrice":27900}  },
              totalStock: 107, 
      imgList: ["http://img6.paipaiimg.com/56611a9a/item-5319A1CF-265FF632000000000401000036F6CA90.0.160x160.jpg","http://img6.paipaiimg.com/6accbb21/item-5319A1CF-265FF632000000000401000036F6CA90.1.160x160.jpg","http://img6.paipaiimg.com/1ea4910e/item-5319A1CF-265FF632000000000401000036F6CA90.2.160x160.jpg","http://img6.paipaiimg.com/9f08d464/item-5319A1CF-265FF632000000000401000036F6CA90.3.160x160.jpg","http://img6.paipaiimg.com/62372c6c/item-5319A1CF-265FF632000000000401000036F6CA90.4.160x160.jpg"],
      cmdtyTitle: "休闲裤",
      cmdtyCode: "265FF632000000000401000036F6CA90",
      isTejia: "false",
      dealType: "1",
      itemState: "2",
      leaf: "243721",
      shop:"855007014",
      propPicMap: {"颜色\:白色":"http://img6.paipaiimg.com/56611a9a/item-5319A1CF-265FF632000000010401000036F6CA90.9.80x80.jpg","颜色\:土黄色":"http://img6.paipaiimg.com/56611a9a/item-5319A1CF-265FF632000000020401000036F6CA90.9.80x80.jpg","颜色\:101藏青色":"http://img6.paipaiimg.com/56611a9a/item-5319A1CF-265FF632000000000401000036F6CA90.9.80x80.jpg"}
*/
  }
  </script>
<script type="text/html" id="propertyTpl">
        <div class="goods_sku_row">
            <div class="goods_sku_tit">{#pName#}</div>
            <div class="goods_sku_list" data-propName="{#pName#}">
            	{#itemList#}
            </div>
        </div>
    </script>
<script type="text/html" id="propertyItemTpl">
    	<span class="goods_sku_option" attr-tag="propItem" data-itemName="{#pName#}:{#item#}" data-prop="{#item#}">{#text#}</span>
    </script>
<script>
var hrefParamsArray = GetSessionIdFromHref(window.location.search);
hrefParamsArray["userName"]='{$userName}';
function showBubble(a,b){
    if (a) {
        b = b || 1500;
        var c = $("#bubble");
        c.css("opacity", 1), c.hasClass("qb_none") || c.html(a), c.html(a).removeClass("qb_none"), setTimeout(function () {
            c.animate({
                opacity: 0
            }, 500, "ease", function () {
                $(this).addClass("qb_none").removeAttr("style")
            })
        }, b)
    }
}
function GetSessionIdFromHref(search){
　　	var args = search.substring(1); 
　　	var retval = new Array(); 
	args = args.split("&"); 
		for(var i = 0; i < args.length; i ++){ 
			str = args[i]; 
			var arg = str.split("="); 
			if(arg.length <= 1) continue; 
			
			if(arg[0] == 'params') {
				var params = decodeURIComponent(arg[1]);
				var obj = eval('(' + params + ')');
				if (obj.rootid != undefined) {
					retval["rootid"] = obj.rootid;
				}
				if (obj.start != undefined) {
					retval["start"] = obj.start;
				}
				if (obj.tplid != undefined) {
					retval["tplid"] = obj.tplid;
				}
				retval["id"] = obj.id;
			} else if(arg[0] == 'customerId') {
				retval["customerId"] = arg[1]; 
			}else if(arg[0] == 'userName'){
				retval["userName"] = arg[1]; 
			} else if(arg[0] == 'method') {
				retval["method"] = arg[1];
			}
		} 
		if (retval["start"] == undefined) {
			retval["start"] = 0;
		}
		return retval; 
}
</script>
<script type="text/javascript">
function buy(btn) {
	if ($(btn).attr("disabled") == 'true') return;
	var data = PP.wx.cmdty.propObj.getSelectedProp(), prop;
  	for (var key in data) {if (!data[key]) return alert("请选择商品的" + key);}

  	var baseUrl =  '{$Think.config.SERVER_HOST}';
 	var urlString = baseUrl + 'call.json?customerId='+ hrefParamsArray["customerId"]+'&userName='+hrefParamsArray["userName"];
 
    if (orderType === 'point') {
    	var isMember = parseInt('{$isMember}');
    	var points = parseInt('{$points}');
    	var myScore = parseInt('{$myScore}');
    }
    if (orderType === 'point') {
    	if (isMember == 0 || isMember == "") {
    		alert("兑换商品需要成为会员，请先注册为会员");
    		return;
    	}
    	if (myScore < points) {
    		alert("您的积分为" + myScore + "积分，尚不够兑换该商品");
    		return;
    	}
    }
    var rootid = '';
 	if (hrefParamsArray["rootid"] !== undefined) {
 		rootid = ',"rootid":' + hrefParamsArray["rootid"];
 	}
    
    var pid = hrefParamsArray['id'];
    var sizes = '';
 	var colors = '';
 	prop = $(btn).attr("data-prop");
 	if (prop != null) {
 		var propItems = prop.split("|");
 	    sizes = encodeURIComponent(propItems[0]);
 	    colors = encodeURIComponent(propItems[1]);
 	}
    var buyNum = 1;
     $.ajax({url : urlString,
 		dataType : "json",
 		type : "post",
 		timeout: 15000,
 		data : {
 			'module': 'product',
 	        'method' : 'preSubmitOrder',
 	        'params' : '{"pids":' + pid + ',"counts":' + buyNum + ',"type":"' + orderType + 
 	        	'","sid":-1,"sizes":"' + sizes + '","colors":"' + colors + '"}'
 	    	},
 		success : function(data) {
 			if (data.code) {
 				alert(data.msg);
 				return;
 			}
 			window.location.href = 'call.html?userName=' + hrefParamsArray['userName'] + '&customerId='
 			+ hrefParamsArray['customerId'] + '&module=product&method=getOrderDetail&params={"tplid":'+hrefParamsArray['tplid']+',"id":"' + data.id + '"' +rootid + '}';
 			//window.location.href = 'call.html?userName=' + hrefParamsArray['userName'] + '&customerId='
 			//+ hrefParamsArray['customerId'] + '&module=product&method=getOrderDetail&params={"tplid":2,"id":' + data.id + rootid + '}';
 		},
 		 error: function(jqXHR, textStatus, errorThrown){
 			 alert('发送超时,可能存在网络异常,检查后请重试...');
 				//$("#showcard").val("保 存");
 				//$("#showcard").attr("disabled", false);
 	     }
 });
 }
 </script>
<script type="text/html" id="commentListTpl">
        <div class="comment_item">
            <p>{#buyerComment#}</p>
            <div class="comment_item_ft">
                <span class="comment_user">{#nick#}</span>
                <span class="comment_date">{#buyerEvalTime#}</span> 
            </div>
        </div>
</script>
<script type="text/javascript" src="wx_assets/js/zepto.1.1.2.min.js?t=20140106"></script>
<script id="legos:21913" ver="21913:20131231:20131231163222" name="PP.wx.cmdty" src="wx_assets/js/pp.wx.cmdty.20140123.js?t=201401211039" charset="gbk"></script>
<script id="legos:21948" ver="21948:20140122:20140218130348" name="PP.wg.mobilereport" src="wx_assets/js/pp.wg.mobilereport.20140122.js?t=20140218130348" charset="gbk"></script>
<!-- 
<script>
  var objMsg = {p:"paipai.com",weixin:1,sku:PAGEMESS.cmdtyCode,shop:PAGEMESS.shop,leaf:PAGEMESS.leaf};
  ECC.cloud.report.pv(objMsg); 
</script> 
 -->
<script type="text/javascript" src="http://static.paipaiimg.com/js/version/2014/01/pp.mobile.ping.20140103.js" charset="gbk" async></script>
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=29459350" charset="UTF-8" async></script>

            
<script type="text/javascript">
function resetAndAppendHerf(search){
　　	var args = search.substring(1); 
　　	var retval = new Array(); 
	args = args.split("&"); 
	for(var i = 0; i < args.length; i ++){ 
		str = args[i]; 
		var arg = str.split("="); 
		if(arg.length <= 1) continue; 
		if(arg[0] == 'userName'){
			args[i] = "userName=";
		}
	} 
	return args.join("&");
}

$(function(){
	var imageUrl = '{$picUrl}';
	var title = '{$name}';
	var des = '{$recommend}' == '' ? '点击这里查看商品' : '{$recommend}';
	var search = '?' + resetAndAppendHerf(window.location.search);
	var shareUrlString = window.location.protocol + "//"
			+ window.location.host + window.location.pathname + search;	      
	
	window.shareData = {
		"imgUrl": imageUrl,
		"timeLineLink":  shareUrlString ,
		"sendFriendLink":  shareUrlString ,
		"weiboLink":  shareUrlString ,
		"tTitle": title,
		"tContent": des,
		"fTitle": title,
		"fContent": des,
		"wContent": des
	};
	document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
		// 发送给好友
		WeixinJSBridge.on('menu:share:appmessage', function (argv) {
			WeixinJSBridge.invoke('sendAppMessage', {
				"img_url":  window.shareData.imgUrl,
				"img_width": "640",
				"img_height": "640",
				"link": window.shareData.sendFriendLink,
				"desc": window.shareData.fContent,
				"title": window.shareData.fTitle
			}, function (res) {
				_report('send_msg', res.err_msg);
			})
		});
	
		// 分享到朋友圈
		WeixinJSBridge.on('menu:share:timeline', function (argv) {
			WeixinJSBridge.invoke('shareTimeline', {
				"img_url": window.shareData.imgUrl,
				"img_width": "640",
				"img_height": "640",
				"link": window.shareData.timeLineLink,
				"desc": window.shareData.tContent,
				"title": window.shareData.tTitle
			}, function (res) {
				_report('timeline', res.err_msg);
			});
		});
	
		// 分享到微博
		WeixinJSBridge.on('menu:share:weibo', function (argv) {
			WeixinJSBridge.invoke('shareWeibo', {
				"content": window.shareData.wContent,
				"url": window.shareData.weiboLink
			}, function (res) {
				_report('weibo', res.err_msg);
			});
		});
	});
});
</script>

</body>
</html>
